package com.org.csu.dao;

import com.org.csu.entity.KeyRecord;
import com.org.csu.entity.Keyword;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * @author YigongLily
 * @version V1.0
 * Copyright (c) 2024, t8669@qq.com All Rights Reserved.
 * @ProjectName:e-commerce-back
 * @Title: RecordRepositity
 * @Package com.org.csu.dao
 * @Description: recordRe
 * @date 2024/12/15 20:48
 */
@Repository
public interface RecordRepository extends JpaRepository<KeyRecord, Integer> {
    //根据recordId查询用户搜索记录
    KeyRecord findRecordByRecordId(Integer recordId);
    //根据时间和关键词锁定
    @Query("SELECT r FROM KeyRecord r WHERE r.date = :date AND r.keyword = :keyword")
    KeyRecord findRecordByDateAndKeyword(String date,String keyword);
}